
<div class="content">
<div class="con">
<div class="breadcrumb">
  <span class="layui-breadcrumb crumbs">
    <a href="?/admin/page/"><?=empty($uper_id)?"<cite>":""?>页面</a>
    <?php foreach ($uper_id as $k => $v) { ?>
      <a href="?/admin/page/<?=$k?>"><?=$v==end($uper_id)?"<cite>":""?><?=$v?></a>
    <?php } ?>
  </span>
</div>
<hr>
<form method="POST" enctype="multipart/form-data">
<!-- 页面左侧 -->
<div class="add_left">
  <div>
    <button class="btn-primary" >提交</button>
    <button class="btn" name="submit_type" value="save" >保存</button>
    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  </div>
  <div >
    <input type="text" name="title" required value="<?=$page['title']?>"  lay-verify="required" placeholder="请输入标题" autocomplete="off"  >
  </div>
  <div>
    http://<?=$site['domain']?>/p/<input type="text" name="name" required value="<?=$page['name']?>"  lay-verify="required" placeholder="请输入页面名称" autocomplete="off" class="page_name">
    <input type="hidden" name="type" value="page" required />
    <input type="hidden" name="upid" value="<?=$page['upid']?>" />
  </div>
  <div class="controls" >
    <textarea name="content" rows="20" ><?=htmlspecialchars($page['content'])?></textarea>
  </div>
  <!-- 模型菜单 -->
  <?php foreach ($model_cfg as $k => $v) { ?>
  <div>
    <label><?=$v['name']?>：</label>
    <?php if($v['type']=="text"){ ?>
      <input type="text" name="meta[<?=$k?>]" value="<?=$page['meta'][$k]?>" autocomplete="off" />
    <?php }else if($v['type']=="content" || $v['type']=="extension"){ ?>
      <textarea name="meta[<?=$k?>]" placeholder="请输入内容" ><?=htmlspecialchars($page['meta'][$k])?></textarea>
    <?php }else if ($v['type']=="file") {?>
      <input type="file" name="meta[<?=$k?>]" value="请选择图片">
      <input type="hidden" name="meta[<?=$k?>_old]" value="<?=$page['meta'][$k]?>">
      <?if($page['meta'][$k]){?>
      <img src="<?=$page['meta'][$k]?>" height="100"/>
      <?}?>
    <?php } ?>
  </div>
  <?php } ?>
  <div>
    <button class="btn-primary" >提交</button>
    <button class="btn" name="submit_type" value="save" >保存</button>
    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  </div>
</div>
<!-- 页面右侧 -->
<div class="add_right" ><div>
  <h3>SEO 配置 </h3>
    <label  >关键词：</label>
    <input type="text" name="meta[keywords]" value="<?=$page['meta'][keywords]?>" autocomplete="off"  >
    <label  >描述：</label>
    <input type="text" name="meta[description]" value="<?=$page['meta'][description]?>" autocomplete="off"  >
    <label  >页面标题：</label>
    <input type="text" name="meta[page_title]" value="<?=$page['meta'][page_title]?>" autocomplete="off"  >

  <h3>高级功能配置 </h3>

  <label   >启用子页面：</label>
  <select type="text" id="more_son" lay-filter="type"   name="meta[type]" onchange="show_son_page(this)">
    <option  <?=$page['meta']['type']=='page'?'selected':''?> value="page" >关闭</option>
    <option  <?=$page['meta']['type']=='list'?'selected':''?> value="list" >启用</option>
  </select>

  <label   >原型选择：</label>
    <select type="text" name="meta[model]" >
      <option></option>
      <?foreach($model as $iid =>$ivalue){?>
      <option  <?=$page['meta']['model']==$iid?'selected':''?> value="<?=$iid  ?>" ><?=$ivalue?></option>
      <?}?>
    </select>

  <label   >排版文件：</label>
  <select type="text"   name="meta[layout]"  >son_page
    <option></option>
    <?foreach($layout as $iid =>$ivalue){?>
    <option  <?=$page['meta']['layout']==$iid?'selected':''?> value="<?=$iid  ?>" ><?=$ivalue?></option>
    <?}?>
  </select>

  <div id="son_page" >
    <h3>子页面设置</h3>
    <label  >每页显示子页面条数：</label>
    <input type="number" name="meta[son_number]" value="<?=$page['meta']['son_number']?>"  placeholder="请输入数量" autocomplete="off"  >
    <label   >子页面原型：</label>
    <select type="text"    name="meta[son_model]"  >
      <option></option>
      <?foreach($model as $iid =>$ivalue){?>
      <option  <?=$page['meta']['son_model']==$iid?'selected':''?> value="<?=$iid  ?>" ><?=$ivalue?></option>
      <?}?>
    </select>

    <label   >排版文件：</label>
    <select type="text"    name="meta[son_layout]">
      <option></option>
      <?foreach($layout as $iid =>$ivalue){?>
      <option  <?=$page['meta']['son_layout']==$iid?'selected':''?> value="<?=$iid  ?>" ><?=$ivalue?></option>
      <?}?>

    </select>
  </div>
  <div><br/></div>
    </div>
  </div>
</form>
<script src="/static/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
<script>

tinymce.init({
  selector:'textarea',
  height:700,
  language:'zh_CN',
  browser_spellcheck: true,
  relative_urls:false,
  contextmenu: false,
  images_upload_url: '?/admin/upload/',
  plugins: [
  	"advlist autolink lists link image charmap print preview anchor",
  	"searchreplace visualblocks code fullscreen",
  	"insertdatetime media table contextmenu paste imagetools wordcount",
  	"code"
  ],
	 toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | code",
});

function show_son_page()
{
 if($('#more_son').val()=='list'){$('#son_page').fadeIn();}else{$('#son_page').fadeOut();}
}
show_son_page();
</script>
